package api

import (
	"github.com/gin-gonic/gin"
	"week32/api/handlers"
	"week32/api/middleware"
	"week32/pkg"
)

func LoadApiRouters(r *gin.Engine) {
	r.Use(middleware.AuthToken())
	user := r.Group("/user")
	{
		user.POST("/login", handlers.Login)

		user.POST("/list", handlers.List)

		user.POST("/chatlist", handlers.ChatList)

		user.Use(pkg.JWTAuth("zj"))
		user.GET("/chat", handlers.Chat)
	}
}
